#ifndef FFMPEGEXTRA_EYERWASMBLOB_READEVENT_HPP
#define FFMPEGEXTRA_EYERWASMBLOB_READEVENT_HPP

#include <string>

#include "EyerWASMCommon/EyerWASMEvent.hpp"
#include "EyerWASMCommon/EyerWASMBuffer.hpp"

namespace Eyer
{
    class EyerWASMBlob_ReadEvent : public EyerWASMEvent
    {
    public:
        EyerWASMBlob_ReadEvent(int blobKey, int64_t pos, int64_t wantLen);
        ~EyerWASMBlob_ReadEvent();

        virtual int Run() override;

        int EyerWASMBlob_ReadEvent_Read_OnSucc(uint8_t * buffer, size_t size);
        int EyerWASMBlob_ReadEvent_Read_OnFail();

        EyerWASMBuffer GetBuffer();

    private:
        int m_blobKey = 0;
        int64_t m_pos = 0;
        int64_t m_wantLen = 0;

        EyerWASMBuffer m_buffer;
    };
}

#endif //FFMPEGEXTRA_EYERWASMBLOB_READEVENT_HPP
